<table>
<?php if($isAdmin): ?>
	<td class="actions">
		<?php echo $this->Html->link('Typy kortów', array('action' => 'fieldType')); ?>
		<?php echo $this->Html->link('Dodaj kort', array('action' => 'add')); ?>
	</td>
<?php endif; ?>
</table>

<table>
	<tr>
		<th><?php echo $this->Paginator->sort('id', 'Id'); ?></th>
		<th><?php echo $this->Paginator->sort('name', 'Nazwa'); ?></th>
		<th><?php echo $this->Paginator->sort('FieldType.name', 'Podłoże'); ?></th>
		<th><?php echo $this->Paginator->sort('covered', 'Zadaszony'); ?></th>
		<th><?php echo $this->Paginator->sort('out_of_order', 'Czynny'); ?></th>
		<th><?php echo $this->Paginator->sort('start_time', 'Godzina otwarcia'); ?></th>
		<th><?php echo $this->Paginator->sort('end_time', 'Godzina zamknięcia'); ?></th>
		<?php if($isAdmin): ?>
			<th>Akcje</th>
		<?php endif; ?>
	</tr>
	<?php foreach($courts as $court): ?>
	<tr>
		<td><?php echo $court['Court']['id']; ?> </td>
		<td><?php echo $court['Court']['name']; ?> </td>
		<td><?php echo $court['FieldType']['name']; ?> </td>
		<td><?php if($court['Court']['covered']) {
			echo 'Tak';
		} else {
			echo 'Nie';
		} ?>
		<td><?php if($court['Court']['out_of_order']) {
			echo 'Nie';
		} else {
			echo 'Tak';
		} ?>
		<td><?php echo $court['Court']['start_time']; ?> </td>
		<td><?php echo $court['Court']['end_time']; ?> </td>
		<?php if($isAdmin): ?>
			<td class="actions">
				<?php echo $this->Html->link('Edytuj', array('action' => 'edit', $court['Court']['id'])); ?>
				<?php echo $this->Form->postLink('Usuń', array('action' => 'delete', $court['Court']['id']), array('confirm'=>'Czy na pewno chcesz usunąć ten kort?')); ?>
			</td>
		<?php endif; ?>
	</tr>
	<?php endforeach; ?>
</table>
<?php echo $this->Paginator->numbers(array('first'=>3,'last' => 3)); ?>